Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add keystroke handlings for elementspath and toolbar plugins #5252

Merged
merged 8 commits into from
Jul 1, 2022

Conversation

KarolDawidziuk
Copy link
Contributor

What is the purpose of this pull request?

Bug fix

Does your PR contain necessary tests?

All patches that change the editor code must include tests. You can always read more
on PR testing,
how to set the testing environment and
how to create tests
in the official CKEditor documentation.

This PR contains

  • Unit tests
  • Manual tests

Did you follow the CKEditor 4 code style guide?

Your code should follow the guidelines from the CKEditor 4 code style guide which helps keep the entire codebase consistent.

  • PR is consistent with the code style guide

What is the proposed changelog entry for this pull request?

* [#438](/~https://github.com/ckeditor/ckeditor4/issues/438): Fixed: There was impossible to navigate to the [elementspath](https://ckeditor.com/cke4/addon/elementspath) from the [toolbar](https://ckeditor.com/cke4/addon/toolbar) by keyboard and vice versa.  

What changes did you make?

The solution was taken from: #2412 PR.
I just extracted the helper function to bender tools and adjusted a little the manual tests.

Which issues does your PR resolve?

Closes #438.

@jacekbogdanski jacekbogdanski self-assigned this Jul 1, 2022
@jacekbogdanski jacekbogdanski self-requested a review July 1, 2022 07:21
Copy link
Member

@jacekbogdanski jacekbogdanski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 👍🏻 I've simplified unit tests as there is no need for an additional helper function (see comment).

Comment on lines 1283 to 1306
/**
* Fires element event handler attribute e.g.
* ```html <button onkeydown="return customFn( event )">x</button>```
*
* @param {CKEDITOR.dom.element/HTMLElement} element Element with attached event handler attribute.
* @param {String} eventName Event handler attribute name.
* @param {Object} evt Event payload.
*/
fireElementEventHandler: function( element, eventName, evt ) {
if ( element.$ ) {
element = element.$;
}

if ( CKEDITOR.env.ie && CKEDITOR.env.version < 9 ) {
var nativeEvent = CKEDITOR.document.$.createEventObject();

for ( var key in evt ) {
nativeEvent[ key ] = evt[ key ];
}

element.fireEvent( eventName, nativeEvent );
} else {
element[ eventName ]( evt );
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need that helper function, as there is already element#fireEventHandler method that covers this polyfill (that helper was moved to core codebase some time ago).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Impossible to navigate to editable from toolbar by keyboard and vice versa
2 participants